//引入组件
import Loading from "./Loading.vue";
import  Vue from "vue";

// 通过vue.extend()新建一个子类LoadingConstructor
// LoadingConstructor是对应的loading的模板
const LoadingConstructor = Vue.extend(Loading);

const service = ()=>{
  var instance = new LoadingConstructor();
  //讲loading实例挂在一个元素上面
  instance.$mount(document.createElement("div"));
  document.body.appendChild(instance.$el);

  //挂载 异步显示
  Vue.nextTick(() => {
    instance.show = true;
    // setTimeout(() => {
    //   instance.show = false;
    // }, 3000);
  });
  return instance;
}

export default service;







